<!DOCTYPE html>
<html lang="en" xmlns:th="http://www.thymeleaf.org">
<head>
<head>
<meta charset="UTF-8">
<meta name="viewport"
	content="width=device-width, user-scalable=no, initial-scale=1.0, maximum-scale=1.0, minimum-scale=1.0">
<meta http-equiv="X-UA-Compatible" content="ie=edge">
<title>spring-boot-thymeleaf!</title>
</head>

<body>
	<h1>
		<p th:text="'Hello, ' + ${name} + '!'" />
	</h1>
	<!--字符串输出-->
	<p th:text="'hello SpringBoot'">hello thymeleaf</p>
	<!--数学运算-->
	<p th:text="9 + 10"></p>
	<p th:text="10 * 10"></p>
	<p th:text="1 - 10"></p>
	<p th:text="8 / 3"></p>
	<p th:text="3 % 2"></p>
	<!--操作域对象-->
	<p th:text="${user}"></p>
	<p th:text="${user.username}"></p>

	<!--遍历数组-->
	<table th:each="item, sta:${user.hobbies}">
		<tr>
			<td th:text="${item}"></td>
			<td th:text="${sta.index}"></td>
			<td th:text="${sta.odd}"></td>
			<td th:text="${sta.size}"></td>
		</tr>
	</table>

	<!--遍历map-->
	<div th:each="item:${user.secrets}" th:text="${item.key}"></div>

	<!--遍历数组-->
	<div th:each="item:${user.hobbies}" th:text="${item}"></div>

	<!--设置属性-->
	<input type="text" th:attr="value=${user.username}">
	<input type="text"
		th:attr="value=${user.username}, title=${user.username}">

	<!--表单数据绑定-->
	<form action="" th:object="${user}">
		<input type="text" th:value="*{username}"> <input
			type="password" th:value="*{password}"> <select>
			<option th:each="item:${user.secrets}" th:text="${item.value}"
				th:selected="'a' eq ${item.value}"></option>
		</select>
	</form>

	<!--解析html文本内容-->
	<p th:utext="'<span>html</span>'"></p>

	<!--流程控制-->
	<p th:if="${user.username} != ${user.password}">yes</p>
	<div th:switch="${user.username}">
		<p th:case="rose">name is rose</p>
		<p th:case="jack">name is jack</p>
	</div>
</body>
</html>